package com.nsy.shortlink.project.service;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.nsy.shortlink.project.dao.entity.ShortLinkDO;
import com.nsy.shortlink.project.dto.biz.ShortLinkStatsRecordDTO;
import com.nsy.shortlink.project.dto.req.ShortLinkCreateReqDTO;
import com.nsy.shortlink.project.dto.req.ShortLinkPageReqDTO;
import com.nsy.shortlink.project.dto.req.ShortLinkUpdateReqDTO;
import com.nsy.shortlink.project.dto.resp.ShortLinkCreateRespDTO;
import com.nsy.shortlink.project.dto.resp.ShortLinkGroupCountQueryRespDTO;
import com.nsy.shortlink.project.dto.resp.ShortLinkPageRespDTO;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.List;

/**
* @author 宁舒意
* @description 针对表【t_link】的数据库操作Service
* @createDate 2024-10-05 10:56:14
*/
public interface ShortLinkService extends IService<ShortLinkDO> {

    /**
     * 创建短链接
    **/
    ShortLinkCreateRespDTO createShortLink(ShortLinkCreateReqDTO requestParam);


    /**
     * 用gid对短链接分页查询
    **/
    IPage<ShortLinkPageRespDTO> pageShortLink(ShortLinkPageReqDTO requestParam);

    List<ShortLinkGroupCountQueryRespDTO> listShortLinkGroup(List<String> requestParam);

    void updateShortLink(ShortLinkUpdateReqDTO requestParam);

    /**
     * 短链接跳转到原始链接
    **/
    void restoreUri(String shortUri, HttpServletRequest request, HttpServletResponse response) throws IOException;



    /**
     * 短链接统计
     *
     * @param shortLinkStatsRecord 短链接统计实体参数
     */
    void shortLinkStats(ShortLinkStatsRecordDTO shortLinkStatsRecord);
}
